﻿using System;
using System.Runtime.InteropServices;

namespace Godot.core.math
{
    public class Vector3
    {
        public enum Axis
        {
            AXIS_X,
            AXIS_Y,
            AXIS_Z,	
        }

        public float x
        {
            get { return coord[0]; }
            set { coord[0] = value; }
        }

        public float y
        {
            get { return coord[1]; }
            set { coord[1] = value; }
        }

        public float z
        {
            get { return coord[2]; }
            set { coord[2] = value; }
        }

        public float[] coord;     

        public float this[int idx]
        {
            get { return coord[idx]; }
            set { coord[idx] = value; }
        }

        public Vector3()
        {
            coord = new float[3];
        }

        public static readonly Vector3 empty = new Vector3(0, 0, 0);

        public Vector3(float p_x, float p_y, float p_z)
        {
            x = p_x; y = p_y; z = p_z;
        }

        public static bool operator ==(Vector3 p_v1, Vector3 p_v2)
        {
            return (p_v1.x == p_v2.x) && (p_v1.y == p_v2.y) && (p_v1.z == p_v2.z);
        }

        public static bool operator !=(Vector3 p_v1, Vector3 p_v2)
        {
            return !(p_v1 == p_v2);
        }

        public override bool Equals(object obj)
        {
            if (obj is Vector3)
            {
                return ((Vector3)obj) == this;
            }
            return base.Equals(obj);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
